﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Whoever.Website.UserControls
{
    public partial class PanelSide : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(IsTop)
            {
                LoadTop();
            }
            else
            {
                LoadFoot();
            }
        }

        #region PROPERTIES

        private Boolean _isTop = true;

        public bool IsTop
        {
            get { return _isTop; }
            set { _isTop = value; }
        }

        private Boolean _isFoot;

        public bool IsFoot
        {
            get { return _isFoot; }
            set { _isFoot = value; }
        }

        private int _width;

        public int Width
        {
            get { return _width; }
            set { _width = value; }
        }



        #endregion

        #region METHODS

        protected void LoadTop()
        {
            Container.Style.Add("width", String.Format("{0}px;", (Width + 4).ToString()));
            Container.Style.Add("margin-top","10px;");
            LeftCorner.Style.Add("background-image", "url('/Resources/Image/Site/Background/PanelTopLeftCorner.png');");
            Center.Style.Add("background-image", "url('/Resources/Image/Site/Background/PanelTopCenter.png');");
            Center.Style.Add("width", String.Format("{0}px;", (Width - 36).ToString()));
            RightCorner.Style.Add("background-image", "url('/Resources/Image/Site/Background/PanelTopRightCorner.png');");
        }

        protected void LoadFoot()
        {
            Container.Style.Add("width", String.Format("{0}px;", (Width + 4).ToString()));
            LeftCorner.Style.Add("background-image", "url('/Resources/Image/Site/Background/PanelFootLeftCorner.png');");
            Center.Style.Add("background-image", "url('/Resources/Image/Site/Background/PanelFootCenter.png');");
            Center.Style.Add("width", String.Format("{0}px;", (Width - 36).ToString()));
            RightCorner.Style.Add("background-image",
                                  "url('/Resources/Image/Site/Background/PanelFootRightCorner.png');");
        }

        #endregion


    }
}